<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <script src="vue.js"></script>
    <title>匿名插槽-slot</title>
</head>

<body>
    <div id="app">

        <my-slot>
            <!-- 当有新的内容时就替换插槽里的内容 -->
            <img src="../../images/6.jpg" alt="../../images/6.jpg">
        </my-slot>

    </div>

    <!-- 模板 -->
    <template id="my_slot">
        <div>
            <header>插槽头部</header>     
            <slot>插槽预留位置，当不用时就显示里面的内容</slot>
            <footer>插槽尾部</footer>

        </div>

    </template>

    <!-- js -->
    <script>
        Vue.component("my-slot", {
            template: "#my_slot"
        });
        new Vue({
            el: "#app"
        })
    </script>

</body>

</html>